import { Body, Controller, Get, HttpCode, HttpStatus, Patch, Post } from '@nestjs/common';
import { ChangeNickName, MessageSubs, addCodeTelegramCode, getCodeTelegramId } from './dto/models.dto';
import { TraderService } from './trader.service';

@Controller('trader')
export class TraderController {
    constructor(private readonly traderService: TraderService) {}

    @HttpCode(HttpStatus.OK)
    @Get('/autopay')
    getList() {
        return this.traderService.autoPay();
    }

    @HttpCode(HttpStatus.OK)
    @Post('/send')
    sendMessage(@Body() infoMessage: MessageSubs) {
        return this.traderService.sendMessage(infoMessage);
    }

    @HttpCode(HttpStatus.OK)
    @Post('/getCodes')
    getCodes(@Body() data: getCodeTelegramId) {
        return this.traderService.getAllReferralCodes(data);
    }

    @HttpCode(HttpStatus.OK)
    @Post('/addCode')
    addCodes(@Body() data: addCodeTelegramCode) {
        return this.traderService.addReferralCode(data);
    }

    @HttpCode(HttpStatus.OK)
    @Patch('/setNick')
    changeNickname(@Body() data: ChangeNickName) {
        return this.traderService.changeNickname(data);
    }
}
